
package robotinterface;

import javax.swing.*;

/**
 *
 * @author Nate Hemmes
 */
public class GripperPositionPanel extends JPanel{

    public GripperPositionPanel(){
        SpringLayout gripPosLay = new SpringLayout();
        setLayout(gripPosLay);
        setBorder(BorderFactory.createEtchedBorder());

        JLabel gripPosLabel = new JLabel("Gripper Position");
        add(gripPosLabel);
        gripPosLay.putConstraint(SpringLayout.WEST, gripPosLabel, 15, SpringLayout.WEST, this);
        gripPosLay.putConstraint(SpringLayout.NORTH, gripPosLabel, 5, SpringLayout.NORTH, this);
        gripPosLay.putConstraint(SpringLayout.EAST, gripPosLabel, -55, SpringLayout.EAST, this);
        gripPosLay.putConstraint(SpringLayout.SOUTH, gripPosLabel, 30, SpringLayout.NORTH, this);


        JLabel xLabel = new JLabel("X:");
        add(xLabel);
        gripPosLay.putConstraint(SpringLayout.WEST, xLabel, 40, SpringLayout.WEST, this);
        gripPosLay.putConstraint(SpringLayout.NORTH, xLabel, 5, SpringLayout.SOUTH, gripPosLabel);
        //gripPosLay.putConstraint(SpringLayout.EAST, xLabel, -55, SpringLayout.EAST, this);
        gripPosLay.putConstraint(SpringLayout.SOUTH, xLabel, -30, SpringLayout.SOUTH, this);
        xLabel.setToolTipText("The east/west position of the gripper reletive to the base ");
        
        JSpinner xSpinner = new JSpinner(new SpinnerNumberModel(50, 0, 100, 1));
        add(xSpinner);
        gripPosLay.putConstraint(SpringLayout.WEST, xSpinner, 15, SpringLayout.EAST, xLabel);
        gripPosLay.putConstraint(SpringLayout.NORTH, xSpinner, 12, SpringLayout.SOUTH, gripPosLabel);
        gripPosLay.putConstraint(SpringLayout.EAST, xSpinner, 75, SpringLayout.EAST, xLabel);
        gripPosLay.putConstraint(SpringLayout.SOUTH, xSpinner, -37, SpringLayout.SOUTH, this);



        JLabel yLabel = new JLabel("Y:");
        add(yLabel);
        gripPosLay.putConstraint(SpringLayout.WEST, yLabel, 59, SpringLayout.EAST, xSpinner);
        gripPosLay.putConstraint(SpringLayout.NORTH, yLabel, 5, SpringLayout.SOUTH, gripPosLabel);
        //gripPosLay.putConstraint(SpringLayout.EAST, yLabel, -55, SpringLayout.EAST, this);
        gripPosLay.putConstraint(SpringLayout.SOUTH, yLabel, -30, SpringLayout.SOUTH, this);
        yLabel.setToolTipText("The north/south position of the gripper reletive to the base ");
        
        JSpinner ySpinner = new JSpinner(new SpinnerNumberModel(50, 0, 100, 1));
        add(ySpinner);
        gripPosLay.putConstraint(SpringLayout.WEST, ySpinner, 15, SpringLayout.EAST, yLabel);
        gripPosLay.putConstraint(SpringLayout.NORTH, ySpinner, 12, SpringLayout.SOUTH, gripPosLabel);
        gripPosLay.putConstraint(SpringLayout.EAST, ySpinner, 75, SpringLayout.EAST, yLabel);
        gripPosLay.putConstraint(SpringLayout.SOUTH, ySpinner, -37, SpringLayout.SOUTH, this);


        JLabel zLabel = new JLabel("Z:");
        add(zLabel);
        gripPosLay.putConstraint(SpringLayout.WEST, zLabel, 79, SpringLayout.EAST, ySpinner);
        gripPosLay.putConstraint(SpringLayout.NORTH, zLabel, 5, SpringLayout.SOUTH, gripPosLabel);
        //gripPosLay.putConstraint(SpringLayout.EAST, yLabel, -55, SpringLayout.WEST, this);
        gripPosLay.putConstraint(SpringLayout.SOUTH, zLabel, -30, SpringLayout.SOUTH, this);
        zLabel.setToolTipText("The vertical position of the gripper reletive to the base ");

        JSpinner zSpinner = new JSpinner(new SpinnerNumberModel(50, 0, 100, 1));
        add(zSpinner);
        gripPosLay.putConstraint(SpringLayout.WEST, zSpinner, 15, SpringLayout.EAST, zLabel);
        gripPosLay.putConstraint(SpringLayout.NORTH, zSpinner, 12, SpringLayout.SOUTH, gripPosLabel);
        gripPosLay.putConstraint(SpringLayout.EAST, zSpinner, 75, SpringLayout.EAST, zLabel);
        gripPosLay.putConstraint(SpringLayout.SOUTH, zSpinner, -37, SpringLayout.SOUTH, this);
    }
}
